/*
 * @Description:
 * @Author: ldx
 * @Date: 2022-04-06 19:34:55
 * @LastEditors: ldx
 * @LastEditTime: 2022-05-06 21:19:47
 */
import React from 'react'
import { Outlet } from 'react-router'

import Layout from '@/layout'
export const routes = [
  {
    path: '/',
    key: 'home',
    component: React.lazy(() => import('@/pages/home')),
    icon: '',
    title: '首页',
    hideInMenu: false,
    auth: ['home']
  },
  {
    path: '/projectManage',
    key: 'projectManage',
    component: React.lazy(() => import('@/pages/projectManage')),
    icon: '',
    title: '项目管理',
    hideInMenu: false,
    auth: []
  },

  {
    path: '/systemSettings',
    key: 'systemSettings',
    component: Outlet,
    redirect: '/systemSettings/predictManage',
    icon: '',
    title: '系统设置',
    hideInMenu: false,
    auth: ['systemSettings'],
    // auth: [],
    routes: [
      {
        path: '/systemSettings/predictManage',
        key: 'predictManage',
        component: React.lazy(() => import('@/pages/predictManage')),
        icon: '',
        title: '预测管理',
        hideInMenu: false,
        auth: ['predictManage']
      },
      {
        path: '/systemSettings/reportManage',
        key: 'reportManage',
        component: React.lazy(() => import('@/pages/reportManage')),
        icon: '',
        title: '报告管理',
        hideInMenu: false,
        auth: ['reportManage']
      }
    ]
  },
  {
    /* 无匹配路由 放置在最后一个路由的位置 */
    path: '*',
    key: '*',
    component: React.lazy(() => import('@/layout/404'))
  }
]
export default [
  {
    path: '/*',
    key: '/*',
    component: Layout,
    routes: routes
  },
  {
    path: '/login',
    key: 'login',
    component: React.lazy(() => import('@/pages/user/login'))
  }
]
export interface RoutesType {
  path: string
  redirect?: string
  key: string
  component?: any
  hideInMenu?: boolean
  icon?: string
  title?: string
  auth?: string[]
  routes?: RoutesType[]
}
